package cn.zymall.user.controller;



import cn.zymall.common.controller.crud.BaseController;
import cn.zymall.common.model.Merchant;
import cn.zymall.user.service.BusinessAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author : th
 * @ClassName: BusinessAccountController
 * @Description : 商家账号管理控制器
 * @date 2020年08月22日 19:42
 **/

@RestController
@RequestMapping("/business")
public class BusinessAccountController extends BaseController<BusinessAccountService, Merchant> {


    @Autowired
    private BusinessAccountService service;


    /**
     * @author：th
     * @Description：商家模糊查询 店铺名，
     * @Param：value
     * @return：List<Merchant>
     **/
    @GetMapping("/accountVague")
    List<Merchant> accountVague(String value){
        return service.accountVuage(value);
    }


    /**
     * @author：th
     * @Description：商家手机号查询
     * @Param：phone
     * @return：Merchant
     **/
    @GetMapping("/findPhone")
    Merchant findPhone(String value){
        System.out.println(value);
        return service.findPhone(value);
    }


    /**
     * @author：th
     * @Description：商家手机验证码登录
     * @Param：value,sms
     * @return：Merchant
     **/
    @GetMapping("/signUp")
    public Merchant signUp(String value , String sms){
        return service.signUp(value,sms);
    }


    /**
     * @author：th
     * @Description：商家账号密码登录
     * @Param：merchant
     * @return：Merchant
     **/
    @GetMapping("/login")
    public Merchant login(Merchant merchant){
        System.out.println(merchant);
        return service.login(merchant);
    }



}
